// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2024 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.13.1
package sysin

import (
	"context"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"

	"github.com/gogf/gf/v2/frame/g"
)

// StockZhAIndexUpdateFields 修改指数字段过滤
type StockZhAIndexUpdateFields struct {
	Code            string  `json:"code"            dc:"代码"`
	Name            string  `json:"name"            dc:"名字"`
	LastPrice       float64 `json:"lastPrice"       dc:"最新价"`
	ChangePercent   float64 `json:"changePercent"   dc:"涨跌幅"`
	ChangeAmount    float64 `json:"changeAmount"    dc:"涨跌额"`
	Volume          float64 `json:"volume"          dc:"成交量"`
	Turnover        float64 `json:"turnover"        dc:"成交额"`
	Amplitude       float64 `json:"amplitude"       dc:"振幅"`
	High            float64 `json:"high"            dc:"最高"`
	Low             float64 `json:"low"             dc:"最低"`
	Open            float64 `json:"open"            dc:"开盘价"`
	Closed          float64 `json:"closed"          dc:"收盘价"`
	VolumeRatio     float64 `json:"volumeRatio"     dc:"量比"`
	YesterdayClosed float64 `json:"yesterdayClosed" dc:"昨收"`
	Date            string  `json:"date"            dc:"日期"`
}

// StockZhAIndexInsertFields 新增指数字段过滤
type StockZhAIndexInsertFields struct {
	Code            string  `json:"code"            dc:"代码"`
	Name            string  `json:"name"            dc:"名字"`
	LastPrice       float64 `json:"lastPrice"       dc:"最新价"`
	ChangePercent   float64 `json:"changePercent"   dc:"涨跌幅"`
	ChangeAmount    float64 `json:"changeAmount"    dc:"涨跌额"`
	Volume          float64 `json:"volume"          dc:"成交量"`
	Turnover        float64 `json:"turnover"        dc:"成交额"`
	Amplitude       float64 `json:"amplitude"       dc:"振幅"`
	High            float64 `json:"high"            dc:"最高"`
	Low             float64 `json:"low"             dc:"最低"`
	Open            float64 `json:"open"            dc:"开盘价"`
	Closed          float64 `json:"closed"          dc:"收盘价"`
	VolumeRatio     float64 `json:"volumeRatio"     dc:"量比"`
	YesterdayClosed float64 `json:"yesterdayClosed" dc:"昨收"`
	Date            string  `json:"date"            dc:"日期"`
}

// StockZhAIndexEditInp 修改/新增指数
type StockZhAIndexEditInp struct {
	entity.StockZhAIndex
}

func (in *StockZhAIndexEditInp) Filter(ctx context.Context) (err error) {
	// 验证代码
	if err := g.Validator().Rules("required").Data(in.Code).Messages("代码不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	return
}

type StockZhAIndexEditModel struct{}

// StockZhAIndexViewInp 获取指定指数信息
type StockZhAIndexViewInp struct {
	Id int `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *StockZhAIndexViewInp) Filter(ctx context.Context) (err error) {
	return
}

type StockZhAIndexViewModel struct {
	entity.StockZhAIndex
}

// StockZhAIndexListInp 获取指数列表
type StockZhAIndexListInp struct {
	form.PageReq
	Id int `json:"id" dc:"id"`
}

func (in *StockZhAIndexListInp) Filter(ctx context.Context) (err error) {
	return
}

type StockZhAIndexListModel struct {
	Id              int     `json:"id"              dc:"id"`
	Code            string  `json:"code"            dc:"代码"`
	Name            string  `json:"name"            dc:"名字"`
	LastPrice       float64 `json:"lastPrice"       dc:"最新价"`
	ChangePercent   float64 `json:"changePercent"   dc:"涨跌幅"`
	ChangeAmount    float64 `json:"changeAmount"    dc:"涨跌额"`
	Volume          float64 `json:"volume"          dc:"成交量"`
	Turnover        float64 `json:"turnover"        dc:"成交额"`
	Amplitude       float64 `json:"amplitude"       dc:"振幅"`
	High            float64 `json:"high"            dc:"最高"`
	Low             float64 `json:"low"             dc:"最低"`
	Open            float64 `json:"open"            dc:"开盘价"`
	Closed          float64 `json:"closed"          dc:"收盘价"`
	VolumeRatio     float64 `json:"volumeRatio"     dc:"量比"`
	YesterdayClosed float64 `json:"yesterdayClosed" dc:"昨收"`
	Date            string  `json:"date"            dc:"日期"`
}
